package com.hui.dao;

import com.hui.entity.Recode;
import com.hui.mapper.RecodeVoMapper;
import com.hui.util.DruidUtil;
import com.hui.vo.RecodeVo;

import java.util.List;

/**
 * @Description
 * @date 2023/2/11 11:47
 */
public class RecodeDao {


    /**
     * 查找出库所有记录
     **/
    public List<RecodeVo> findRecodeVoAll() {
        String sql = " select re.*,ma.login_name,pr.productName,ca.categoryId,ca.categoryName ,wa.warehouseName from record re\n" +
                ", tb_managers ma,tb_product pr, tb_category ca,tb_warehouse wa\n" +
                "where re.mgr_id=ma.mgr_id  and pr.productId=re.productId and ca.categoryId=pr.categoryId and wa.warehouseId=pr.warehouseId";
        return DruidUtil.commonFindListByParam(sql, new RecodeVoMapper());
    }

    /**
     * 新增记录信息
     **/
    public void insertRecode(Recode recode) {
        String sql = "insert into record value(null,?,?,?,?)";
        DruidUtil.commonUpdate(sql, recode.getProductId(), recode.getMgrId(), recode.getCreateTime(), recode.getNum());
    }
}
